<?php

namespace globalunit\model;

use globalunit\model\RedisPOB;
use QYS\Util\Debug;
use QYS\Core\Config as CoreConfig;
use globalunit\utils\Config;
use QYS\Log\Log;

class LuckyDrawLogModel extends BaseModel
{
    public $id              = 0;       // 主键
    public $wid             = 0;
    public $uid             = 0;
    public $cur_star_num    = 0;
    public $star_num        = 0;
    public $last_star_num   = 0;
    public $created_at      = "";
    public $updated_at      = "";
    public $deleted_at      = "";

    public function __construct()
    {
        parent::__construct('yyz_lucky_draw_log');
    }

    public function save($except = [])
    {
        if ($this->id > 0) {
            $this->updated_at = date("Y-m-d H:i:s");
            return parent::save();
        }
    }

    public function insert()
    {
        $this->created_at = date("Y-m-d H:i:s");
        return parent::insert();
    }

    public function addstar()
    {
        if ($this->id > 0) {
            $this->star_num = $this->star_num + 1;
            $this->updated_at = date("Y-m-d H:i:s");
            return parent::save();
        }
    }

    public function toArray()
    {
        $a = parent::toarray();
        return $a;
    }
}
